<template>
  <div>
        <el-button type="danger" @click="addDomain" :icon="Plus" style="float: left;;margin-left: 10px;">新增</el-button>&emsp;
        <el-button :disabled="!buttonDisable" type="danger" @click="allDomain()" :icon="Check" style="float: left;;margin-left: 10px;"  >保存</el-button>&emsp;
        <el-button :disabled="!buttonDisable" type="danger" @click="delDomain" :icon="Back" style="float: left;;margin-left: 10px;">撤销</el-button>&emsp;
        <el-button :disabled="!buttonDisable" type="danger" @click="delDomains" :icon="Delete" style="float: left;;margin-left: 10px;">删除</el-button>&emsp;
        <el-button type="danger"  @click="dialogFormVisible=true" :icon="Plus" style="float: left;;margin-left: 10px;">批量设置信息</el-button>&emsp;
        <el-button type="danger" @click="dialogFormVisible1=true"  :icon="Plus" style="float: left;;margin-left: 10px;">批量选择种母</el-button>&emsp;
  </div>
  <br>
   &nbsp;&nbsp;
    <span style="color: red;" >*</span>负责人：
     <el-select v-model="allCreatId" placeholder="负责人" clearable style="width: 150px;" @change="getallCreatId()" >
        <el-option v-for="item in procationDtas" :label="item.firstName" :value="item.employeeId"  />
      </el-select>
  &emsp;<span style="color: red;" >*</span>配种日期：<el-date-picker
        v-model="ProDates"
        type="date"
        placeholder="Pick a date"
        style="width: 150px;"
        :default-value="new Date()"
     
      />
      &nbsp;&nbsp; &nbsp;&nbsp;
单据号：<el-input v-model="proCodes" style="width: 180px;" disabled >
        </el-input>
     &emsp;&emsp;
     流水号：<el-input v-model="weater" style="width: 180px;" disabled >
        </el-input>
    
        <br /><br>
    <hr style="font-size: 20px;" />
    <br />


        <div  class="table-container" style=" height: 400px;position: relative;">
        <table style="border-collapse: collapse;" >
            <tr>
      <td >序号</td>
      <td >耳号</td>
      <td >首配公羊</td>
      <td >配种方式</td>
      <td >种母发情类型</td>
      <td >首配评分</td>
      <td style="width: 200px">当前栋舍</td>
      <td style="width: 180px">当前栏位</td>
      <td >转入栋舍</td>
      <td >转入栏位</td>
      <td >繁殖状态</td>
      <td style="width: 180px">事件日期</td>
      <td style="width: 210px;" >重量</td>
    </tr>
            <tr v-for="(ruleForm, index) in loge.healthArray">
              
               <td>
                {{ ruleForm.indexNumber }}
        
      </td>
      <td>
        <el-select v-model="ruleForm.motherSleepInforId" placeholder="种母耳号" style="width: 100px;"@change="getSurname(ruleForm,index)" clearable >
        <el-option v-for="item in motherDatas" :label="item.earNumber" :value="item.sleepInforId"   />
      </el-select>
      </td>
      <td >
         <el-select v-model="ruleForm.fatherSleepInforId" placeholder="公羊耳号" style="width: 100px;" clearable >
        <el-option v-for="item in surnameDatas" :label="item.earNumber" :value="item.sleepInforId"   />
      </el-select>
      </td>
      <td >
         <el-select style="width: 100px;" v-model="ruleForm.hybridizationTypeId" placeholder="配种方式"  clearable  >
        <el-option v-for="item in hybridizationTypeDatas" :label="item.hybridizationTypeName" :value="item.hybridizationTypeId" />
      </el-select>
      </td>
      <td >
         <el-select style="width: 100px;" v-model="ruleForm.estrusTypeId" placeholder="发情类型"  clearable  >
        <el-option v-for="item in estrusDatas" :label="item.estrusTypeName" :value="item.estrusTypeId" />
      </el-select>
      </td>
      <td>
        <el-input
          v-model="ruleForm.mark" style="width: 100px; "class="center-input"
        ></el-input>
      </td>
       <td >
         <el-select style="width: 140px;" v-model="ruleForm.cottagesId" placeholder="当前栋舍" disabled   >
        <el-option v-for="item in cottagesDatas" :label="item.cottageName" :value="item.cottagesId" />
      </el-select>
      </td>
     
      <td>
         <el-select v-model="ruleForm.fieIdId" placeholder="当前栏位" clearable style="width: 100px;" disabled >
        <el-option v-for="item in allFieds" :label="item.fieIdName" :value="item.fieIdId"  />
      </el-select>
      </td>
       <td >
         <el-select style="width: 120px;" v-model="ruleForm.toCottageId" placeholder="转入栋舍"  @change="getFields(ruleForm.toCottageId,index)"   clearable  >
        <el-option v-for="item in cottagesDatas" :label="item.cottageName" :value="item.cottagesId"/>
      </el-select>
      </td>
     
      <td>
         <el-select v-model="ruleForm.toFieIdId" placeholder="转入栏位" clearable style="width: 100px;" >
        <el-option v-for="item in fieldsDatas[index]" :label="item.fieIdName" :value="item.fieIdId"  />
      </el-select>
      </td>
      <td>
       <el-tag type="danger" v-if="ruleForm.breedStatuId==1" >后备空怀</el-tag>
       <el-tag type="danger" v-if="ruleForm.breedStatuId==2" >返情空怀</el-tag>
       <el-tag type="danger" v-if="ruleForm.breedStatuId==3" >未孕空怀</el-tag>
       <el-tag type="danger" v-if="ruleForm.breedStatuId==4" >流产空怀</el-tag>
       <el-tag type="danger" v-if="ruleForm.breedStatuId==5" >空胎空怀</el-tag>
       <el-tag type="danger" v-if="ruleForm.breedStatuId==6" >妊娠</el-tag>
       <el-tag type="danger" v-if="ruleForm.breedStatuId==7" >哺乳</el-tag>
      </td>
      <td>
        <el-date-picker
        type="date"
        placeholder="选择事件日期"
        style="width: 150px;"
        v-model="ProDates"
        disabled
      />
      </td>
      
      <td>
        <el-input
          v-model="ruleForm.weanWeight"
          style="width: 190px;text-align: center;"
          oninput="value=value.replace(/^\D*([0-9]\d*\.?\d{0,2})?.*$/,'$1')"
          placeholder="请输入数字(小数点后两位)"
          class="center-input"
        ></el-input>
      </td>
            </tr>
        </table>

    </div>
        <div style="bottom: 0; left: 0;width: 100%;;">
            <hr>
            <!-- <span>&emsp; 合计</span>
            <hr> -->
            <el-button link type="danger" :icon="Plus" style="float: left;;margin-left: 10px;"
                @click="addDomain">增行</el-button>&emsp;
            <el-button link type="danger" :icon="Minus" style="float: left;;margin-left: 10px;"
                @click="delDomain">删行</el-button>&emsp;
            <br />
            <hr>
            <span style="vertical-align: top;width: 5%;">&emsp; 备注</span>&emsp;
            <el-input v-model="reamrks" type="textarea" style="width: 85%;" placeholder="请输入备注信息" />
        </div>

<div>
    <!-- 对话框新增 -->
  <el-dialog v-model="dialogFormVisible" title="批量设置信息" width="600" >
    <el-form
      ref="ruleFormRef"
      style="max-width: 600px"
    
      :model="ruleFormf"
      :rules="rules"
      label-width="auto"
      :size="formSize"
      status-icon
       class="myDialogClass"
    >
      <el-form-item el-form-item label="配种公羊:" prop="fatherSleepInforId">
       <el-select v-model="ruleFormf.fatherSleepInforId" placeholder="请选择" style="width: 150px;" clearable >
        <el-option v-for="item in surnameDatas" :label="item.earNumber" :value="item.sleepInforId"   />
      </el-select>
      </el-form-item>
      <el-form-item label="配种方式:" prop="hybridizationTypeId">
       <el-select style="width: 150px;" v-model="ruleFormf.hybridizationTypeId" placeholder="请选择"  clearable  >
        <el-option v-for="item in hybridizationTypeDatas" :label="item.hybridizationTypeName" :value="item.hybridizationTypeId" />
      </el-select>
      </el-form-item>
      <el-form-item label="种母发情类型:" prop="estrusTypeId">
        <el-select style="width: 150px;" v-model="ruleFormf.estrusTypeId" placeholder="请选择"  clearable  >
        <el-option v-for="item in estrusDatas" :label="item.estrusTypeName" :value="item.estrusTypeId" />
      </el-select>
      </el-form-item>

      <el-form-item label="转入位置（栋舍）:"prop="toCottageId"  >
         <el-select style="width: 150px;"  v-model="ruleFormf.toCottageId" placeholder="请选择"  @change="getField2(Number(ruleFormf.toCottageId))"   clearable  >
        <el-option v-for="item in cottagesDatas" :label="item.cottageName" :value="item.cottagesId"/>
      </el-select>
    </el-form-item>

      <el-form-item label="转入位置(栏位):" prop="toFieIdId" >
          <el-select style="width: 150px;" v-model="ruleFormf.toFieIdId" placeholder="请选择" clearable  >
        <el-option v-for="item in Fields2" :label="item.fieIdName" :value="item.fieIdId"  />
      </el-select>
      </el-form-item>
        
        
        
    </el-form>
    <template #footer>
      <div class="dialog-footer">
         <el-button type="danger"  @click="resetForm(ruleFormRef)">清空</el-button>
        <el-button type="danger" @click="resetForm1(ruleFormRef)">返回</el-button>
        <el-button type="danger" @click="submitForm(ruleFormRef)">
          批量设置
        </el-button>
      </div>
    </template>
  </el-dialog>


</div>
<!-- MotherLists -->
<div>
  <el-dialog v-model="dialogFormVisible1" title="批量选种母" width="1000" >
    品种： <el-select style="width: 150px;" v-model="selectMotherForm.varietyId" placeholder="请选择"   clearable  >
        <el-option label="杜泊" value="1"/>
        <el-option label="澳洲白" value="2"/>
        <el-option label="萨福克" value="3"/>
        <el-option label="杜湖" value="4"/>
        <el-option label="杜杜湖" value="5"/>
        <el-option label="萨杜湖" value="6"/>
        <el-option label="澳湖" value="7"/>
        <el-option label="湖羊" value="8"/>
        <el-option label="澳杜湖" value="9"/>
      </el-select>
      <br>
      繁殖状态：<el-checkbox v-model="breedStatuIdArry" value='1,,2,3,4,5,6' label="全部" size="large" border />
      <el-checkbox v-model="breedStatuIdArry"  value="1" label="后备空怀" size="large" border />
      <el-checkbox v-model="breedStatuIdArry"  value="2" label="空怀" size="large" border />
      <el-checkbox v-model="breedStatuIdArry"  value="3" label="返情空怀" size="large" border />
      <el-checkbox v-model="breedStatuIdArry"  value="4" label="流产空怀" size="large" border />
      <el-checkbox v-model="breedStatuIdArry"  value="5" label="空胎空怀" size="large" border />
      <el-checkbox v-model="breedStatuIdArry"  value="6" label="断奶空怀" size="large" border />
      <br>
      羊只月龄：<el-input style=" width: 120px; " v-model="selectMotherForm.startMoonAge" placeholder="点击输入月龄" ></el-input>--<el-input  placeholder="点击输入月龄"  style=" width: 120px; " v-model="selectMotherForm.endMoonAge" ></el-input>
      <br>
      位置： <el-select style="width: 100px;" v-model="selectMotherForm.recordcottageId" placeholder="请选择"  @change="getField2(Number(selectMotherForm.recordcottageId))"   clearable  >
        <el-option v-for="item in cottagesDatas" :label="item.cottageName" :value="item.cottagesId"/>
      </el-select>
        &emsp;
         <el-select v-model="selectMotherForm.fieIdId" placeholder="请选择" clearable style="width: 100px;">
        <el-option v-for="item in Fields2" :label="item.fieIdName" :value="item.fieIdId"  />
      </el-select>
<el-button type="danger" @click="getMotherLists()"  >查询</el-button>
        <el-table :data="MotherLists" style="width: 100%">
    <el-table-column prop="date" label="序号"  >
       <template #default="{$index}" >
        {{ $index+1 }}
      </template>
    </el-table-column>
    <el-table-column prop="earNumber" label="可视耳号"  />
    <el-table-column prop="electronicEarTag" label="电子耳号"  />
    <el-table-column prop="varietyId" label="品种"  >
      <template v-slot="scope" >
        <el-tag type="danger" v-if="scope.row.varietyId==1" >杜泊</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==2" >澳洲白</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==3" >萨福克</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==4" >杜湖</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==5" >杜杜湖</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==6" >萨杜湖</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==7" >澳湖</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==8" >湖羊</el-tag>
        <el-tag type="danger" v-if="scope.row.varietyId==9" >澳杜湖</el-tag>
      </template>
    </el-table-column>
    <el-table-column prop="name" label="繁殖状态"  >
      <template v-slot="scope" >
         <el-tag type="danger" v-if="scope.row.breedStatuId==1" >后备空怀</el-tag>
        <el-tag type="danger" v-if="scope.row.breedStatuId==2" >空怀</el-tag>
        <el-tag type="danger" v-if="scope.row.breedStatuId==3" >返情空怀</el-tag>
        <el-tag type="danger" v-if="scope.row.breedStatuId==4" >流产空怀</el-tag>
        <el-tag type="danger" v-if="scope.row.breedStatuId==5" >空胎空怀</el-tag>
        <el-tag type="danger" v-if="scope.row.breedStatuId==6" >断奶空怀</el-tag>
      </template>
    </el-table-column>
    <el-table-column prop="weanData" label="月龄" >
      <template v-slot="scope" >
        {{ scope.row.ageMonth.toFixed(2) }}
      </template>
    </el-table-column>
  </el-table>
  <el-button type="danger" @click="addMotherList()" > 设置分配结果 </el-button>



  </el-dialog>
</div>
  



</template>

<script setup lang="ts">
import {
  Check,
  Delete,
  Edit,
  Message,
  Back,
  Plus,
  Setting,
  SuccessFilled,
  Minus,
  Close,
} from '@element-plus/icons-vue'
import { reactive, ref, onMounted, computed } from 'vue';
import axios from 'axios';
import { useRoute, useRouter } from 'vue-router';
import { ElMessage, ElMessageBox } from 'element-plus';
import { useCounterStore } from '@/stores/counter';
import type { ComponentSize, FormInstance, FormRules } from 'element-plus';

const counterStore = useCounterStore();
const route = useRoute();
const router = useRouter();
const allCreatId = ref('')
const numbers = ref(1)
const indexNumber=ref(0)
//备注
const reamrks: any = ref('')

//单据号
const proCodes = ref('');
//流水号
const weater = ref('');

//期初日期
const ProDates = ref(new Date());
const loge = reactive({
  healthArray: <any>[
    reactive({
indexNumber:numbers.value,
      motherSleepInforId: '',
      fatherSleepInforId: '',
      hybridizationTypeId: '',
      estrusTypeId: '',
      mark: '',
      toCottageId: '',
      toFieIdId: '',
      documentNumber: '',
      createId: counterStore.employeeId ,
      cottagesId: '',
      fieIdId: '',
      breedStatuId:'',
      weanWeight:''
    })
  ],
});



//顶部按钮（是否可点）
const buttonDisable = computed(() => {
  return loge.healthArray.length>0
})
//增行
const addDomain = () => {
  loge.healthArray.push(
    reactive({
      chargePerson:'',
      indexNumber: loge.healthArray.length + numbers.value,
      documentNumber: JSON.stringify(proCodes.value) ,
      motherSleepInforId: '',
      fatherSleepInforId: '',
      hybridizationTypeId: '',
      estrusTypeId: '',
      mark: '',
      toCottageId: '',
      toFieIdId: '',
      createId: counterStore.employeeId,
      cottagesId: '',
      fieIdId: '',
      breedStatuId: '',
      weanWeight:''
  }));
  console.log(loge.healthArray);
  indexNumber.value++;
};
//减行
const delDomain = () => {
  loge.healthArray.splice(loge.healthArray.length - 1, 1)
   indexNumber.value--;
}

//保存





//删除
const delDomains = () => {
  loge.healthArray.splice(0, loge.healthArray.length)
  numbers.value=1
}
//获取雪花id(单据号、流水号)
const getIds1 = () => {
  axios.post('http://localhost:5039/api/ProductionManagement/GetId', {}).then(res => {
    proCodes.value = res.data
    loge.healthArray[0].documentNumber = JSON.stringify(res.data)
  })
}
const getIds2 = () => {
  axios.post('http://localhost:5039/api/ProductionManagement/GetId', {}).then(res => {
    weater.value=res.data
  })
}

//获取负责人信息
const procationDtas:any = ref([])
const getProcationDatas = () => {
  axios.post("http://localhost:5039/api/Cottages/SearchEmployees", {}).then(res => {
    procationDtas.value = res.data.data
  })
}

//获取负责人
const getallCreatId = () => {
  loge.healthArray.forEach((c: any) => {
    c.chargePerson = allCreatId.value
  })
}

//首配公羊耳号信息
const surnameDatas:any = ref([])
const getSurnameDatas = () => {
  axios.get("http://localhost:5039/api/SleepBegin/SelectEarMale").then(res => {
    surnameDatas.value=res.data.data
  })
}
//种母耳号信息
const motherDatas: any = ref([])
const getMotherDatas = () => {
  axios.get("http://localhost:5039/api/SleepBegin/SelectEarFeMale").then(res => {
    motherDatas.value=res.data.data
  })
}

//配种方式
const hybridizationTypeDatas: any = ref([])
const getHybridizationTypes = () => {
  axios.get("http://localhost:5039/api/ProductionManagement/SearchHybridizationTypes").then(res => {
    hybridizationTypeDatas.value=res.data.data
  })
}

//种母发情类型
const estrusDatas  :any= ref([])
const getEstrusDatas = () => { 
  axios.get("http://localhost:5039/api/ProductionManagement/SearchEstrusTypes").then(res => {
    estrusDatas.value = res.data.data
  })
}

//获取栋舍信息
const cottagesDatas:any=ref([])
const getCottages = () => {
  axios.post("http://localhost:5039/api/Cottages/CottageList", {}).then(res => {
    cottagesDatas.value=res.data.data
  })
}
//获取栋舍下栏位信息（可增行）
const fieldsDatas: any = ref([])
const getFields = (cottagesId: number, index: number) => {
  fieldsDatas.value[index]=[]
  const request: any = ref({})
  request.cottagesId=cottagesId
  axios.post("http://localhost:5039/api/Cottages/SearchFields", request).then(res => {
    console.log(res.data.data)
    fieldsDatas.value[index] = (res.data.data);
    loge.healthArray[index].toFieIdId=''
  })
}
//获取全部栏位信息
const allFieds:any=ref([])
const getFields1 = () => {
  const request: any = ref({})
  axios.post("http://localhost:5039/api/Cottages/SearchFields", request).then(res => {
    console.log(res.data.data)
    allFieds.value= res.data.data
  })
}

//获取栋舍下栏位信息
const Fields2: any = ref([])
const getField2 = (cottagesId: number) => {
  ruleFormf.toFieIdId=''
  const request: any = ref({})
  request.cottagesId = cottagesId;
  axios.post("http://localhost:5039/api/Cottages/SearchFields", request).then(res => {
    Fields2.value=res.data.data
  })
}

//根据耳号获取羊只信息
const getSurname = (item: any, index: number) => {
  console.log(item)
  axios.get("http://localhost:5039/api/ProductionManagement/EarMasList", {
    params: {
      sleepInforId: item.motherSleepInforId,
      breedStatuId:0
    }
  }).then(res => {
    console.log(res.data.item)
    loge.healthArray[index].cottagesId = res.data.item.recordcottageId
    loge.healthArray[index].fieIdId = res.data.item.fieIdId
    loge.healthArray[index].breedStatuId = res.data.item.breedStatuId
    loge.healthArray[index].weanWeight = res.data.item.weanWeight.toFixed(2)
    console.log(loge.healthArray[index])
  })
}

//获取耳号下拉信息
const sleepInfoDatas: any = ref([])
const getSleepInfos = () => {
  axios.get("http://localhost:5039/api/SleepBegin/SelectEar").then(res => {
    console.log(res)
    sleepInfoDatas.value= res.data.item
  })
}



//全部保存
const allDomain = () => {
  console.log(loge.healthArray)
  try{
    loge.healthArray.forEach((c: any) => {
      if (c.mark == '' || c.toCottageId == '' || c.toFieIdId == '',c.hybridizationTypeId==''||c.estrusTypeId==''||c.fatherSleepInforId==''||c.motherSleepInforId==''||c.chargePerson=='') {
        ElMessage.error('还有信息未选择或填写,请再次检查！！！');
        throw new Error('End Loop')
        
      }
    })
  } catch (e) {
      e
  }

  console.log(loge.healthArray)
  const request: any = ref({})
  request.datas = loge.healthArray
axios.post("http://localhost:5039/api/ProductionManagement/MotherHybidizationAdd", request).then(res => {
    console.log(res.data.code)
  if (res.data.code > 0) {
    ElMessage.success("添加成功");
    loge.healthArray.length = 0;
  } else {
      ElMessage.error("添加失败，再试试！！")
    }
  })
  
  

}

//对话框批量新增信息
const dialogFormVisible = ref(false)


const formSize = ref<ComponentSize>('default');
const ruleFormRef = ref<FormInstance>();

const ruleFormf = reactive({
  fatherSleepInforId: '',
  hybridizationTypeId: '',
  estrusTypeId: '',
  toCottageId: '',
  toFieIdId: '',
})

//非空验证
const rules = reactive<FormRules>({
  fatherSleepInforId: [{ required: true, message: '配种公羊未选择', trigger: 'change' }],
  hybridizationTypeId: [{ required: true, message: '配种方式未选择', trigger: 'change' }],
  estrusTypeId: [{ required: true, message: '种母发情类型未选择', trigger: 'change' }],
  toCottageId: [{ required: true, message: '转入栋舍未选择', trigger: 'change' }],
  toFieIdId: [{ required: true, message: '转入栏位未选择', trigger: 'change' }],
});

//清空
const resetForm = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.resetFields()
}
//返回
const resetForm1 = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.resetFields()
  dialogFormVisible.value = false
}

//添加种公信息
const submitForm = async (formEl: FormInstance | undefined) => {
  if (!formEl) return;
  await formEl.validate((valid, fields) => {
    if (valid) {
      dialogFormVisible.value=false
      dialogFormVisible1.value = true;
      getMotherLists();
    } else {
      console.log('error submit!', fields);
    }
  });
};

//批量选种母
const dialogFormVisible1 = ref(false);
const breedStatuIdArry:any=ref([])

const selectMotherForm = reactive({
  varietyId: '',
  breedStatuId: breedStatuIdArry,
  startMoonAge: '',
  endMoonAge: '',
  recordcottageId: '',
  fieIdId:''
})

const MotherLists:any=ref([])
const getMotherLists = () => {
  const request: any = ref({})
  request.varietyId = selectMotherForm.varietyId||0
  request.breedStatuIds = selectMotherForm.breedStatuId.toString()
  request.startMoonAge = parseFloat(selectMotherForm.startMoonAge)  || 0
  request.endMoonAge = parseFloat(selectMotherForm.endMoonAge) || 0
  request.recordcottageId = selectMotherForm.recordcottageId || 0
  request.fieIdId = selectMotherForm.fieIdId || 0
  console.log(request.startMoonAge)
  axios.post("http://localhost:5039/api/ProductionManagement/MotherListSearch", request).then(res => {
    console.log(res.data.data)
    MotherLists.value=res.data.data
  })
}


const addMotherList = () => {
  MotherLists.value.forEach((c:any) => {
     loge.healthArray.push(
    reactive({
      indexNumber: loge.healthArray.length + numbers.value,
      documentNumber: JSON.stringify(proCodes.value),
      motherSleepInforId: c.sleepInforId,
      fatherSleepInforId: ruleFormf.fatherSleepInforId,
      hybridizationTypeId: ruleFormf.hybridizationTypeId,
      estrusTypeId: ruleFormf.estrusTypeId,
      mark: '',
      toCottageId: ruleFormf.toCottageId,
      toFieIdId: ruleFormf.toFieIdId,
      createId: counterStore.employeeId,
      cottagesId: c.recordcottageId,
      fieIdId: c.fieIdId,
      breedStatuId: c.breedStatuId,
      weanWeight:c.weanWeight.toFixed(2)
    }))
  dialogFormVisible1.value=false
  });
 
}



onMounted(() => {
  getIds1();
  getIds2();
  getProcationDatas();
  getSurnameDatas();
  getMotherDatas();
  getHybridizationTypes();
  getEstrusDatas();
  getCottages();
  getSleepInfos();
  getFields1()
});
</script>

<style scoped>
  .demo-pagination-block+.demo-pagination-block {
    margin-top: 10px;
}

.demo-pagination-block .demonstration {
    margin-bottom: 16px;
}

/* 设置第一行的 td 顶部边框加粗并设置为红色 */
table tr:first-child td {
    border-top: 3px solid red;
    /* 设置顶部边框为3px宽度的红色 */
    padding: 10px;
    text-align: center;
}

/* 设置 td 的样式 */

table td {
    padding: 10px;
    border: 1px solid #ccc;
    text-align: center;
    font-size: 14px;
    height: 60px;
    width: 150px;
     white-space: nowrap;  /* 防止内容换行 */
}

/* 可选：为 table 添加样式 */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/*______________________________________________________*/

.table-container {
  max-width: 100%;
  overflow-x: auto;  /* 启用水平滚动 */
  margin: 20px 0;  /* 设置容器的外边距 */
}

:deep(.el-input__wrapper) {
box-shadow: none;
text-align: center;
}

:deep(.el-select__wrapper) {
box-shadow: none;
}
::v-deep(.center-input .el-input__inner ){
    text-align: center;
}

</style>

